public class HF_ClientWSClass {


  // This method is to Modify Contact information in .Net application.
     @future (callout=true)
  public static void ModifyContact(set<Id> conset) {
  string outputresult;  
  List<Contact> ConList = new List<Contact>([select Id,Partner_Contact_ID__c,FirstName,Middle_Name__c,LastName,Preferred_Name__c,Gender__c,Status__c from Contact where ID In: conset]); 
  habitatOrg25.Pims s = new  habitatOrg25.Pims();
  for(contact con: conList){
        system.debug('******'+con);
        //Stores contact details in ContactWrapper
        habitatOrg25.ContactWrapper c=new habitatOrg25.ContactWrapper();
        c.SfdcContactID = con.Id;
        c.PartnerContactID=con.Partner_Contact_ID__c;
        //c.NameID = null; //  Illegal assignment from String to Integer
        c.FirstName=con.FirstName;
        c.MiddleName=con.Middle_Name__c;
        c.LastName=con.LastName;
        c.PreferredName=con.Preferred_Name__c;
        c.Gender=con.Gender__c;
        c.Status=con.Status__c;
        //c.LoginID=null;
        c.DataOn=null;//created date or last modified date
         try 
         {
        //system.debug('Call contactwrapper'+c);
        outputresult=s.ModifyContact(c,'Y');
       // system.debug('Call Webservice------->'+outputresult);
        }
        catch(Exception ex)
          {
          system.debug('output from webservice: '+ex);       
    }
      }
      }
    
  @future (callout=true)
  public static void ModifyPhone(set<Id> phset) {
  string outputresult;
  List<Contact_Phone__c> phList = new List<Contact_Phone__c>([select Id,Partner_Contact_ID__c,Phone__c,Extension__c,Phone_Type__c,Preferred__c,Country__c,Status__c from Contact_Phone__c where ID In: phset]); 
  habitatOrg25.Pims s = new  habitatOrg25.Pims();
  for(Contact_Phone__c ph: phList){
        system.debug('******'+ph);
        //Stores contact details in PhonesWrapper
        habitatOrg25.PhonesWrapper p=new habitatOrg25.PhonesWrapper();
        p.SfdcPhoneID = ph.Id;
        p.PartnerContactID=ph.Partner_Contact_ID__c;
        //p.NameID = Integer.Valueof(ph.Name_Id__c);  
        p.Phone=ph.Phone__c;
       // p.Extn=ph.Extension__c;
        p.PhoneType=ph.Phone_Type__c;
       // p.PreferredPhone=ph.Preferred__c;
        p.Comments=null;
        p.Country=ph.Country__c;
        p.Status=ph.Status__c;
        p.LoginID=null;
        p.DataOn=null;
        try
        {
        outputresult=s.ModifyPhone(p,'N');
        }
        catch(Exception ex)
          {
          system.debug('output from webservice: '+ex);       
    }
        }       
    } 
     
  @future (callout=true)
  public static void ModifyEmail(set<Id> mailset) {
  string outputresult;
  List<Contact_Email__c> mailList = new List<Contact_Email__c>([select Id,Contact__r.Partner_Contact_ID__c from Contact_Email__c where ID In: mailset]); 
  habitatOrg25.Pims s = new  habitatOrg25.Pims();
  for(Contact_Email__c mal: mailList){
        system.debug('******'+mal);
        //Stores contact details in EmailsWrapper
        habitatOrg25.EmailsWrapper e=new habitatOrg25.EmailsWrapper();
        e.SfdcEmailID = mal.Id;
        e.PartnerContactID=mal.Partner_Contact_ID__c;
        //e.NameID = Integer.Valueof(mal.Name_Id__c);   Illegal assignment from String to Integer
        e.NameID=null;
        e.EmailType=null;
        e.Email=null;
        e.PreferredEmail=null;
        e.Comments=null;
        e.LoginID=null;
        e.DataOn=null;
        try
        {
        outputresult=s.ModifyEmail(e,'N');
        }
       catch(Exception ex)
          {
          system.debug('output from webservice: '+ex);       
    }
        }       
    } 
    
  @future (callout=true)
  public static void ModifyAddress(set<Id> addset) {
  string outputresult;
  List<Contact_Address__c> addList = new List<Contact_Address__c>([select Id from Contact_Address__c where ID In: addset]); 
  habitatOrg25.Pims s = new  habitatOrg25.Pims();
  for(Contact_Address__c add: addList){
        system.debug('******'+add);
        //Stores contact details in AddressWrapper
        habitatOrg25.AddressWrapper c=new habitatOrg25.AddressWrapper();
        c.SfdcAddressID= add.Id;
        c.PartnerContactID=null;
        //c.NameID = con.Name_Id__c;   Illegal assignment from String to Integer
        c.NameID=null;
        c.AddressType=null;
        //c.AddressType=add.Contact__r.Address_Type__c;
        c.PreferredAddress=null;
        c.StreetAddress=null;
        c.AddressLine1=null;
        c.AddressLine2=null;
        c.City=null;
        c.State=null;
        c.Country=null;
        c.ZipCode=null;
        c.ZipCodeExtension=null;
        c.Comments=null;
        c.status=null;
        c.LoginID=null;
        c.DataOn=null;
        try
        {
        outputresult=s.ModifyAddress(c,'N');
        }
        catch(Exception ex)
          {
          system.debug('output from webservice: '+ex);       
    }
        }       
    } 
    @future (callout=true)
  public static void ModifyAccount(set<Id> accset) {
  string outputresult;
  List<Account> accList = new List<Account>([select Id,Name,Partner_ID__c, HFH_Organization_Status__c,HFHI_Internal_Comments__c from Account where ID In: accset]); 
  habitatOrg25.Pims s = new  habitatOrg25.Pims();
  for(account acc: accList){
        system.debug('******'+acc);
        //Stores contact details in AddressWrapper
        habitatOrg25.AccountWrapper c=new habitatOrg25.AccountWrapper();
        c.SfdcAccountID= acc.Id;
        c.AccountName=acc.Name;
        c.HFHIPartnerID=acc.Partner_ID__c;
        c.HFHIOrganisationStatus=acc.HFH_Organization_Status__c;
        c.AccountType=null;
        c.HFHIInternalComments=acc.HFHI_Internal_Comments__c;
        c.LoginID=null;
        c.DataOn=null;
       try
       {
        outputresult=s.ModifyAccount(c,'N');
        }
        catch(Exception ex)
          {
          system.debug('output from webservice: '+ex);       
    }
        
        }       
    }  
        @future (callout=true)
  public static void ModifyServiceAreaZipCode(set<Id> zipset) {
  string outputresult;
  List<Service_Area_Zip_Codes__c> zipList = new List<Service_Area_Zip_Codes__c>([select Id,Postal_Code__c from Service_Area_Zip_Codes__c where ID In: zipset]); 
  habitatOrg25.Pims s = new  habitatOrg25.Pims();
  for(Service_Area_Zip_Codes__c zp: zipList){
        system.debug('******'+zp);
        //Stores contact details in EmailsWrapper
        habitatOrg25.ServiceAreaZipCodeWrapper c=new habitatOrg25.ServiceAreaZipCodeWrapper();
        c.SfdcServiceAreaZipCodeID=zp.Id;
        c.HFHIPartnerID=null;
        c.PostalCode=zp.Postal_Code__c;
        c.LoginID=null;
        c.DataOn=null;
        try
        {
        outputresult=s.ModifyServiceAreaZipCode(c,'N');
        }
        catch(Exception ex)
          {
          system.debug('output from webservice: '+ex);       
    }
        }       
    } 
    @future (callout=true)
  public static void ModifyClassification(set<Id> clset) {
  string outputresult;
  List<Classification__c> clList = new List<Classification__c>([select Id,Affiliate_Account__r.Partner_ID__c,Classification_Code__c,Classification_Value__c,Start_Date__c,Status__c from Classification__c where ID In: clset]); 
  habitatOrg25.Pims s = new  habitatOrg25.Pims();
  for(Classification__c cl: clList){
        system.debug('******'+cl);
        //Stores contact details in EmailsWrapper
        habitatOrg25.ClassificationWrapper c=new habitatOrg25.ClassificationWrapper();
        c.SfdcClassificationID= cl.Id;
        c.HFHIPartnerID=cl.Affiliate_Account__r.Partner_ID__c;
        c.ClassificationCode=cl.Classification_Code__c;
        c.ClassificationValue=cl.Classification_Value__c;
        c.NameID=null;
        c.StartDate=cl.Start_Date__c;
        c.EndDate=null;
        c.Status=cl.Status__c;
        c.Comments=null;
        c.LoginID=null;
        c.DataOn=null;
       try
       {
        outputresult=s.ModifyClassification(c,'N');
        }
        catch(Exception ex)
          {
          system.debug('output from webservice: '+ex);       
    }
        }       
    } 
    
    @future (callout=true)
  public static void ModifyRelationship(set<Id> relset) {
  string outputresult;
  List<Relationship__c> relList = new List<Relationship__c>([select Id,Partner_Contact_ID__c,Relationship_Type__c,Start_Date__c,Status__c,Related_Partner_Id__c,Related_Name_Id__c from Relationship__c where ID In: relset]); 
  habitatOrg25.Pims s = new  habitatOrg25.Pims();
  for(Relationship__c rel: relList){
        //system.debug('******'+rel);
        habitatOrg25.RelationshipWrapper c=new habitatOrg25.RelationshipWrapper();
        c.SfdcRelationshipID= rel.Id;
        c.PartnerContactID=rel.Partner_Contact_ID__c;
        c.RelationshipType=rel.Relationship_Type__c;
        c.StartDate=null;
        c.EndDate=rel.Start_Date__c;
        c.Comments=null;
        c.Status=rel.Status__c;
        c.RelatedPartnerID=rel.Related_Partner_Id__c;
        c.RelatedNameID=null;
        c.LoginID=null;
        c.DataOn=null;
        try
        {
        outputresult=s.ModifyRelationship(c,'N');
        }
        catch(Exception ex)
          {
          system.debug('output from webservice: '+ex);       
    }
        }       
    }
    }
   /* @future (callout=true)
public static void GetContactDetails(set<Id> reconset) {
List<Contact> ConList = new List<Contact>([select Id,Email,Partner_Contact_ID__c from Contact where ID In: reconset]);
habitatOrg25.Pims s = new habitatOrg25.Pims();
for(contact con: conList){ 

List<habitatOrg25.GetContactDetailsResult_element> results = s.GetContactDetails(con.Partner_Contact_ID__c,null);

// If we want to Iterate the results
for(habitatOrg25.GetContactDetailsResult_element tcon:results){
system.debug('tcon-->'+tcon);
        }
    }      
  }
 }*/